package net.lab1024.sa.admin.module.aneswork.anes;


import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.aneswork.anes.domain.AnesWorkEntity;

import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.QueryForm;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.module.support.apiencrypt.annotation.ApiDecrypt;
import net.lab1024.sa.base.module.support.apiencrypt.annotation.ApiEncrypt;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

@RestController
@Tag(name = "麻醉规培工作量接口")
public class AensworkController {

    @Resource
    private AnesworkService anesworkService;



    @Operation(summary = "分页查询麻醉工作量")
    @PostMapping("/anes/aneswork/query")
    public ResponseDTO<PageResult<AnesWorkEntity>> queryByPage(@RequestBody @Valid QueryForm data) {
        return anesworkService.queryByPage(data);
    }

    @ApiDecrypt
    @ApiEncrypt
    @Operation(summary = "分页查询麻醉工作量-加密")
    @PostMapping("/anes/aneswork/page/query/encrypt")
    public ResponseDTO<PageResult<AnesWorkEntity>> queryByPageEncrypt(@RequestBody @Valid QueryForm data) {
        return anesworkService.queryByPage(data);
    }

    @Operation(summary = "查询麻醉全部工作量")
    @PostMapping("/anes/aneswork/page/queryAll")
    public ResponseDTO<List<AnesWorkEntity>> queryByPage() {
        return anesworkService.queryAll();
    }

    @ApiDecrypt
    @ApiEncrypt
    @Operation(summary = "根据ID查询麻醉工作量")
    @PostMapping("/anes/aneswork/page/queryById")
    public ResponseDTO<AnesWorkEntity> queryById(AnesWorkEntity data) {
        return anesworkService.queryById(data.getId());
    }



    @ApiDecrypt
    @ApiEncrypt
    @Operation(summary = "更新麻醉工作量")
    @PostMapping("/anes/aneswork/update")
    public ResponseDTO<String> update(@RequestBody @Valid AnesWorkEntity data) {
        return anesworkService.update(data);
    }

    @Operation(summary = "删除麻醉工作量")
    @PostMapping("/anes/aneswork/delete")
    public ResponseDTO<String> delete(@RequestBody @Valid AnesWorkEntity data) {
        return anesworkService.delete(data);
    }


    @ApiDecrypt
    @ApiEncrypt
    @Operation(summary = "新增麻醉工作量")
    @PostMapping("/anes/aneswork/add")
    public ResponseDTO<String> add(@RequestBody @Valid AnesWorkEntity data) {
        return anesworkService.add(data);
    }

}
